/*
 * TakeNumberForm.java
 *
 * Created on 03 May 2008, 16:39
 */

package com.dabarobjects.mobile.ui.inputs;

import com.dabarobjects.ui.surfaces.RoundedBlackPanel;
import com.dabarobjects.ui.surfaces.actions.DataActionInput;
import javax.swing.JDialog;
import javax.swing.JPanel;

/**
 *
 * @author  user
 */
public class TakeNumberForm extends RoundedBlackPanel implements DataActionInput<String> {

    /** Creates new form TakeNumberForm */
    public TakeNumberForm() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        fadeLabel1 = new com.dabarobjects.ui.surfaces.components.FadeLabel();
        fadeTextField1 = new com.dabarobjects.ui.surfaces.components.FadeTextField();
        cancelDial = new com.dabarobjects.ui.surfaces.components.FadeButton();
        dialNumber = new com.dabarobjects.ui.surfaces.components.FadeButton();

        fadeLabel1.setText("Provide Number To Dial");
        fadeLabel1.setFont(new java.awt.Font("Trebuchet MS", 0, 18)); // NOI18N

        fadeTextField1.setFont(new java.awt.Font("Trebuchet MS", 0, 18)); // NOI18N

        cancelDial.setText("Cancel Dial");
        cancelDial.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelDialActionPerformed(evt);
            }
        });

        dialNumber.setText("Dial Number");
        dialNumber.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dialNumberActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(fadeTextField1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 487, Short.MAX_VALUE)
                    .addComponent(fadeLabel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 487, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(dialNumber, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cancelDial, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(fadeLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(fadeTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cancelDial, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(dialNumber, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

private void dialNumberActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dialNumberActionPerformed
// TODO add your handling code here:
    number = fadeTextField1.getText();
    cancelled = false;
    this.parentUI.setVisible(false);
}//GEN-LAST:event_dialNumberActionPerformed

private void cancelDialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelDialActionPerformed
// TODO add your handling code here:
    cancelled = true;
    this.parentUI.setVisible(true);
}//GEN-LAST:event_cancelDialActionPerformed
    private String number;
    public String inputAfterSubmit() {
        return number;
    }
    private boolean cancelled;
    
    public boolean cancelAction() {
        return cancelled;
    }

    public void resetPanel() {
         
    }

    public void initResources() {
         
    }
    private JDialog parentUI;

    public void setParentUI(JDialog d) {
        this.parentUI = d;
    }

    public JPanel formPanel() {
        return  this;
    }


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private com.dabarobjects.ui.surfaces.components.FadeButton cancelDial;
    private com.dabarobjects.ui.surfaces.components.FadeButton dialNumber;
    private com.dabarobjects.ui.surfaces.components.FadeLabel fadeLabel1;
    private com.dabarobjects.ui.surfaces.components.FadeTextField fadeTextField1;
    // End of variables declaration//GEN-END:variables

}
